package T;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

/**
 * @Author:zimmor
 * @Date: 2021/10/29 8:54
 * @Description 使用泛型类
 * @version: 1.0.0
 */

public class NumberTest {
    public static void main(String[] args) throws ClassNotFoundException, IOException {
        Number<String> stringNumber = new Number<>("1", "2");
        String firstNum = stringNumber.getFirstNum();
        String secondNum = stringNumber.getSecondNum();
//        System.out.println("secondNum = " + secondNum);
//        System.out.println("firstNum = " + firstNum);
        Number.printAll("测试泛型类中的泛型方法");

        Class<? extends Number> aClass = stringNumber.getClass();
        Class<Person> personClass = Person.class;
        Class<? extends Number> aClass2 = stringNumber.getClass();
        Class<String> aClass1 = (Class<String>) Class.forName("java.lang.String");
        Info info = new Info();
        Class<? extends Info> aClass4 = info.getClass();
        T t = new T();
        Class aClass5 = t.getClass();
        URL resource = aClass.getResource("a.xml");
        System.out.println("resource = " + resource);
        InputStream resourceAsStream = aClass.getResourceAsStream("/a.xml");

        int buff = 1024;
        int tmp = -1;
        byte[] result = new byte[1024];
        int i = 0;
        while((tmp = resourceAsStream.read()) != -1) {
            System.out.print((char) tmp);
        }


    }
}
